package com.houdehong.wsserver.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * WebSocket配置类，用于在Spring上下文中配置WebSocket相关的组件
 */
@Configuration
public class WebSocketConfig {

    /**
     * 创建并注册ServerEndpointExporter bean
     * ServerEndpointExporter的作用是将标记了@ServerEndpoint注解的类
     * 注册为WebSocket的端点，使得Spring应用可以处理WebSocket请求
     *
     * @return ServerEndpointExporter实例，用于自动扫描和注册
     * 标记了@ServerEndpoint注解的类
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

}
